package com.yict.csms.resourceplan.service.impl;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yict.common.entity.PageEntity;
import com.yict.common.service.impl.CommonService;
import com.yict.csms.resourceplan.dao.impl.RtgcFlWhartNeedDaoImpl;
import com.yict.csms.resourceplan.entity.RtgcFlWhartNeed;
import com.yict.csms.resourceplan.service.IRtgcFlWhartNeedService;

@Service("rtgcFlWhartNeedService")
public class RtgcFlWhartNeedServiceImpl extends CommonService<RtgcFlWhartNeed, Long> implements IRtgcFlWhartNeedService {

	public List<RtgcFlWhartNeed> list(Map<String, Object> queryMap, PageEntity page,
			LinkedHashMap<String, Boolean> orderList) {
		List<RtgcFlWhartNeed> list = new ArrayList<RtgcFlWhartNeed>();
		int count = rtgcFlWhartNeedDao.queryCount(queryMap);
		if (count > 0) {
			int startIndex = 0;
			int maxSize = 0;
			if (page != null) {
				startIndex = (page.getToPage() - 1) * page.getPageSize();
				maxSize = page.getPageSize();
			}
			list = rtgcFlWhartNeedDao.list(queryMap, orderList, startIndex, maxSize);
		}
		if (page != null)
			page.setTotalRecord(count);
		return list;
	}
	
	@Autowired
	private RtgcFlWhartNeedDaoImpl rtgcFlWhartNeedDao;
}
